﻿namespace Ayatta.Contract.Domain
{
    public class MagicKit : IMagic
    {
        public bool Status { get; set; }
        public string Message { get; set; }

        public MagicKit()
            : this(false, null)
        {

        }
        public MagicKit(bool status)
            : this(status, null)
        {

        }
        public MagicKit(bool status, string message)
        {
            Status = status;
            Message = message;
        }
    }
    public class MagicKit<T> : IMagic
    {
        /// <summary>
        /// 当Status为true表示正常,false为不正常
        /// </summary>
        public bool Status { get; set; }

        /// <summary>
        /// 信息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        public T Data { get; set; }

        public MagicKit()
            : this(false, string.Empty, default(T))
        {

        }

        public MagicKit(bool status)
            : this(status, string.Empty, default(T))
        {

        }

        public MagicKit(T data)
            : this(false, string.Empty, data)
        {

        }

        public MagicKit(bool status, T data)
            : this(status, string.Empty, data)
        {

        }

        public MagicKit(bool status, string message, T data)
        {
            Status = status;
            Message = message;
            Data = data;
        }
    }

    public sealed class MagicKit<T, TExtra> : MagicKit<T>
    {
        /// <summary>
        /// 扩展数据
        /// </summary>
        public TExtra Extra { get; set; }

        public MagicKit()
            : this(false, string.Empty, default(T), default(TExtra))
        {

        }

        public MagicKit(bool status)
            : this(status, string.Empty, default(T), default(TExtra))
        {

        }

        public MagicKit(T data, TExtra extra)
            : this(false, string.Empty, data, extra)
        {

        }

        public MagicKit(bool status, T data, TExtra extra)
            : this(status, string.Empty, data, extra)
        {

        }

        public MagicKit(bool status, string message, T data, TExtra extra)
            : base(status, message, data)
        {
            Extra = extra;
        }

    }
}